@extends('Admin.layout.layout')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商家资质</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="tabs-container">
                            <div class="tab-content">
                                <div id="tab-1" class="tab-pane active">
                                    <div class="panel-body">
                                        <div class="row">
                                            <form action="" method="GET">
                                                <div class="col-sm-12">
                                                    <button type="submit" class="btn btn-sm btn-primary fr"> 搜索</button>
                                                    <div class="input-group fr10">
                                                        <input type="text" placeholder="请输入资质名称/商家名称" class="input-sm form-control" name="value" value="">
                                                    </div>
                                                </div>
                                            </form>
                                        </div>
                                        <table class="table table-striped table-bordered table-hover dataTable" id="editable">
                                            <thead>
                                                <tr>
                                                    <th class="center">资质名称</th>
                                                    <th class="center">级别</th>
                                                    <th class="center" width="300">商家</th>
                                                    <th class="center">状态</th>
                                                    <th class="center">更新时间</th>
                                                    <th class="center">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                                <tr>
                                                    <td class="center">15201</td>
                                                    <td class="center">
                                                        <p>
                                                            <font>一级</font>
                                                        </p>
                                                        <p>
                                                            <font>二级</font>
                                                        </p>
                                                        <p>
                                                            <font>三级</font>
                                                        </p>
                                                    </td>
                                                    <td class="center">
                                                        杭州奥策服务公司
                                                    </td>
                                                    <td class="center">
                                                        已审核
                                                    </td>
                                                    <td class="center">
                                                        2018/02/07
                                                    </td>
                                                    <td class="center">
                                                        <select   data-id="1" style="margin-right: 10px;" class="status_search">
                                                            <option value="0">未审核</option>
                                                            <option value="1">已审核</option>
                                                            <option value="2">未通过</option>
                                                        </select>
                                                        <a class="btn-xs btn-warning cancel_btn" data-id="1">强制下架</a>
                                                    </td>
                                                </tr>

                                                <tr class="no-records-found center"><td colspan="8">没有找到匹配的记录</td></tr>

                                            </tbody>
                                        </table>
                                        <div class="row">
                                            include('Admin.common.paginate')
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{{asset('js/plugins/layer/layer.min.js')}}"></script>
    <script>
        $(document).ready(function () {

            //审核
            $(".status_search").change(function(){
                edit_id = $(this).attr("data-id");//编辑时属性的id
                var status_val = $(this).val();
                $.ajax({
                    url: "",
                    type: 'put',
                    dataType: 'json',
                    data: {'status': status_val},
                    success: function (data) {
                        if (0 == data.code) {
                           location.reload();
                        } else {
                            layer.alert(data.message, {
                                icon: 2
                            });
                        }
                    }
                });
            });
            //删除
            $('.cancel_btn').click(function(){
                var order_id = $(this).attr('data-id');
                layer.confirm('是否强制下架？', {
                    btn: ['确认', '取消'] //可以无限个按钮
                }, function (index) {
                    $.ajax({
                        url: '',
                        type: 'PUT',
                        dataType: 'json',
                        data: {},
                        success: function (data) {
                            if (0 == data.code) {
                                layer.alert(data.message, {
                                    icon: 1
                                }, function () {
                                    location.reload();
                                });
                            } else {
                                layer.alert(data.message, {
                                    icon: 2
                                });
                            }
                        },
                    });
                }, function (index, layero) {
                    layer.close(index);
                });
            })

        });
    </script>
@endsection
